package com.netty.httpService;

import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 * Created by Administrator on 2018/9/7/007.
 */
public class ServiceInitializer extends ChannelInitializer {
    @Override
    protected void initChannel(Channel channel) throws Exception {
        //不能弄成单例的，使用Netty提供的Http编解码组件
        channel.pipeline().addLast("HttpServerCodec", new HttpServerCodec());
        //加入自定义的逻辑
        channel.pipeline().addLast("ServiceHandler", new ServiceHandler());
    }
}
